package com.berchen.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * 获取IOC容器
 */
@Component
public class SpringContextUtils1 implements ApplicationContextAware {

    private ApplicationContext ioc;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

        ioc=applicationContext;
    }
    public ApplicationContext getIoc(){
        return ioc;
    }
}
